using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using FairyGUI;
using UnityEngine.Events;

public class PopUpWindow : Window
{
    GButton m_confirmBtn;
    GButton m_cancelBtn;
    UnityAction confirmEvent;
    UnityAction cancelEvent;

    public PopUpWindow(UnityAction confirmEventVal,UnityAction cancelEventVal)
    {
        confirmEvent = confirmEventVal;
        cancelEvent = cancelEventVal;

    }

    protected override void OnInit()
    {
        this.contentPane = UIPackage.CreateObject("CommonPackage", "Popup").asCom;
        this.Center();
        this.modal = true;


        m_confirmBtn = contentPane.GetChild("confirmBtn").asButton;
        m_confirmBtn.onClick.Add(OnConfirmEvent);
        m_cancelBtn = contentPane.GetChild("cancelBtn").asButton;
        m_cancelBtn.onClick.Add(OnHidePanel);
    }

    void OnConfirmEvent()
    {
        confirmEvent();
    }


    void OnHidePanel()
    {
        this.Hide();
    }

   
}
